package com.ruoyi.web.controller.system.Fdongbei;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.Fdongbei.domain.dibang.TbMMGuozhong;
import com.ruoyi.system.Fdongbei.service.ITbMMGuozhongService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * tbController
 * 
 * @author ruoyi
 * @date 2025-02-10
 */
@RestController
@RequestMapping("/system/MMguozhong")
public class TbMMGuozhongController extends BaseController
{
    @Autowired
    private ITbMMGuozhongService tbGuozhongService;

    /**
     * 查询tb列表
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:list')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @GetMapping("/list")
    public TableDataInfo list(TbMMGuozhong tbGuozhong)
    {
        startPage();
        List<TbMMGuozhong> list = tbGuozhongService.selectTbGuozhongList(tbGuozhong);
        return getDataTable(list);
    }

    /**
     * 导出tb列表
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:export')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "tb", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbMMGuozhong tbGuozhong)
    {
        List<TbMMGuozhong> list = tbGuozhongService.selectTbGuozhongList(tbGuozhong);
        ExcelUtil<TbMMGuozhong> util = new ExcelUtil<TbMMGuozhong>(TbMMGuozhong.class);
        util.exportExcel(response, list, "tb数据");
    }

    /**
     * 获取tb详细信息
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:query')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @GetMapping(value = "/{czbh}")
    public AjaxResult getInfo(@PathVariable("czbh") String czbh)
    {
        System.out.println(czbh+"-----<");
        return success(tbGuozhongService.selectTbGuozhongByCzbh(czbh));
    }

    /**
     * 新增tb
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:add')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "tb", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbMMGuozhong tbGuozhong)
    {
        return toAjax(tbGuozhongService.insertTbGuozhong(tbGuozhong));
    }

    /**
     * 修改tb
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:edit')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "tb", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbMMGuozhong tbGuozhong)
    {

        System.out.println("---tbGuozhong--->"+tbGuozhong.toString());
        return toAjax(tbGuozhongService.updateTbGuozhong(tbGuozhong));
    }

    /**
     * 删除tb
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:merge:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:guozhong:remove')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "tb", businessType = BusinessType.DELETE)
	@DeleteMapping("/{czbhs}")
    public AjaxResult remove(@PathVariable String[] czbhs)
    {
        return toAjax(tbGuozhongService.deleteTbGuozhongByCzbhs(czbhs));
    }
}
